<template>
  <div class="home">
    <h4>
      我是Home -- {{ num }}
      <!-- {{ $store.state.count }} -->
    </h4>
    <button @click="add">++</button>
  </div>
</template>

<script>
// use   hooks
import { useStore } from 'vuex'
import { useCount } from '../hooks/count'
export default {
  name: 'Home',
  setup() {
    // const { commit } = useStore()
    // commit('add')

    // 自定义hook
    const { num, add } = useCount()
    return {
      num,
      add
    }
  }
}
</script>
